package com.qiaoanju.web.security.handler;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by eversec
 * on 2017/9/22.
 */
public class CustomuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler {

    public static Logger logger = LogManager.getLogger(CustomuthenticationFailureHandler.class.getName());
    public CustomuthenticationFailureHandler() {
        super();
    }

    public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {

        logger.info("自定义认证失败！"+exception.getMessage());
        super.onAuthenticationFailure(request, response, exception);

    }
}
